package com.youi.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.youi.common.Common;
import com.youi.common.DelStatus;
import com.youi.dao.SetleaderlevelDao;
import com.youi.entity.Setleaderlevel;
import com.youi.service.SetleaderlevelService;

@Service
public class SetleaderlevelServiceImpl extends BaseServiceImpl<Setleaderlevel> implements SetleaderlevelService{
		
		private SetleaderlevelDao setleaderlevelDao;
		
		@Autowired
		public void setfaultRecordDao(SetleaderlevelDao setleaderlevelDao){
			this.setleaderlevelDao=setleaderlevelDao;
			super.setBaseDAO(setleaderlevelDao);
		}

		@Override
		public Double getLeaderRate(Integer level) {
			// TODO Auto-generated method stub
			if (level!=null) {
				Map<String, Object>	prams=new HashMap<String, Object>();
				prams.put(Common.DELSTATUS, DelStatus.NODEL);
				prams.put("status", 1);
				prams.put("level", level);
				Setleaderlevel setleaderlevel=setleaderlevelDao.getObject(prams);
				if (setleaderlevel!=null) {
					return setleaderlevel.getRate();
				}
			}
			return 0.15;
		}
}